package com.niiwoo.civet.scheduler.trigger;

import com.alibaba.dubbo.config.annotation.Reference;
import com.niiwoo.civet.trade.service.loan.ProjectBackoutBorrowPrizeDubboService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ProjectBackoutBorrowPrizeJobTrigger {

    @Reference(version = "1.0.0")
    ProjectBackoutBorrowPrizeDubboService projectBackoutBorrowPrizeDubboService;

    @Scheduled(cron = "${loan.back-borrow-prize}")
    public void backBorrowPrize(){
        log.info("==========backBorrowPrizeJob invoke start==========");
        try {
            projectBackoutBorrowPrizeDubboService.backAll();
        } catch (Exception e) {
            log.error(String.format("backBorrowPrizeJob invoke error: %s", e.getMessage()), e);
        }
        log.info("==========backBorrowPrizeJob invoke start==========");
    }

}
